import React, { Component } from "react";
import { Switch, Route, Redirect, Link } from "react-router-dom";
import { Tree, Menu } from "antd";
import securityhome from "./home";
import Whitelists from "./Whitelists";
import police from "./police";
import uWhitelists from "./uWhitelists";
import Remote from "./Remote";
const { TreeNode } = Tree;
class security extends Component {
  constructor(props) {
    super(props);
    this.state = {
      current: "1",
    };
  }
  handleClick = (e) => {
    this.setState({
      current: e.key,
    });
  };

  render() {
    return (
      <div>
        <div
          style={{
            border: "1px solid #e8e8e8",
            width: "15%",
            minHeight: "600px",
            float: "left",
          }}
        >
          <Tree
            defaultExpandedKeys={["0-0-0", "0-0-1"]}
            defaultSelectedKeys={["0-0-0-0-0-0"]}
            defaultCheckedKeys={["0-0-0", "0-0-1"]}
            defaultExpandAll
          >
            <TreeNode title="服务器" key="0-0">
              <TreeNode title="新建厂区" key="0-0-1" />
              <TreeNode title="实验室一" key="0-0-0">
                <TreeNode title="工作组一" key="0-0-0-0">
                  <TreeNode title="windows XP" key="0-0-0-0-0">
                    <TreeNode title="mydevice" key="0-0-0-0-0-0" />
                  </TreeNode>
                </TreeNode>
              </TreeNode>
            </TreeNode>
          </Tree>
        </div>
        <div style={{ width: "84%", float: "left", margin: 5 }}>
          <div>
            <Menu
              onClick={this.handleClick}
              selectedKeys={[this.state.current]}
              mode="horizontal"
            >
              <Menu.Item key="1">
                <Link to="security">终端信息</Link>
              </Menu.Item>
              <Menu.Item key="2">
                <Link to="/security/whitelists">白名单信息</Link>
              </Menu.Item>
              <Menu.Item key="3">
                <Link to="/security/police">报警日志</Link>
              </Menu.Item>
              <Menu.Item key="4">
                <Link to="/security/uWhitelists">U盘管控</Link>
              </Menu.Item>
              <Menu.Item key="5">
                <Link to="/security/Remote">远程证明日志</Link>
              </Menu.Item>
            </Menu>
          </div>
        </div>
        <Switch>
          <Route path="/security" component={securityhome} exact />
          <Route path="/security/whitelists" component={Whitelists} />
          <Route path="/security/police" component={police} />
          <Route path="/security/uWhitelists" component={uWhitelists} />
          <Route path="/security/Remote" component={Remote} />
          <Redirect to="/security" />
        </Switch>
      </div>
    );
  }
}
export default security;
